package com.chuanyang.driverh.mainmy.adapter;


import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.chuanyang.driverh.R;
import com.chuanyang.driverh.base.OnCustomListener;
import com.chuanyang.driverh.responseresult.LogisticsCompanyData;

import java.util.List;


/**
 * 西风多少恨，吹不散眉弯！—唐大帅
 *
 * @author 唐帅
 *         申请加入车队的适配器
 *         created at
 */

public class TranslateComAdapter extends BaseAdapter {
    private Context context;
    private OnCustomListener listener;
    private TextView tv_translatecom_name;


    public void setList(List<LogisticsCompanyData> list) {
        this.list = list;
        this.notifyDataSetChanged();
    }

    private List<LogisticsCompanyData> list;

    public TranslateComAdapter(Context context, List<LogisticsCompanyData> list) {
        this.context = context;
        this.list = list;
    }


    @Override
    public int getCount() {
        return list.size();
    }

    @Override
    public Object getItem(int position) {
        return list.get(position);
    }

    @Override
    public long getItemId(int position) {
        return 0;
    }

    @Override
    public View getView(final int position, View convertView, ViewGroup parent) {
        if (convertView == null)
        {
            convertView = View.inflate(context, R.layout.my_item_tranalstecom, null);
            tv_translatecom_name = (TextView) convertView.findViewById(R.id.tv_translatecom_name);
        }

        LogisticsCompanyData bean = list.get(position);

        tv_translatecom_name.setText(bean.getLogisticsCompanyName());

        return convertView;
    }


}
